<template>
  <el-button text type="primary" @click="dialogVisible = true">
    注册
  </el-button>

  <el-dialog
      v-model="dialogVisible"
      :before-close="handleClose"
      title="注册"
      width="50%"
  >
    <div>
      <el-input placeholder="Please input"/>
    </div>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogVisible = false">取消</el-button>
        <el-button type="primary" @click="dialogVisible = false">
          确定
        </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
import {ref} from 'vue'
import {ElMessageBox} from 'element-plus'

const dialogVisible = ref(false)
let data = ref({
  address: "",
  code: "",
  email: "",
  nickName: "",
  password: "",
  phone: "",
  sex: "",
  username: ""
})
const handleClose = (done: () => void) => {
  ElMessageBox.confirm('确定要退出吗')
      .then(() => {
        done()
      })
      .catch(() => {
        // catch error
      })
}
</script>
<style scoped>
.dialog-footer button:first-child {
  margin-right: 10px;
}
</style>
